//
//  HzCell.swift
//  Auscultation
//
//  Created by 来 on 2020/12/8.
//

import UIKit

class HzCell: UICollectionViewCell {
    
    var tx: UIImageView!
    var mz: UILabel!
    var nl: UILabel!
    var tz: UILabel!
    var sg: UILabel!
    var sj: UILabel!
    var status: UIView!
    var status_l: UILabel!
    var xsj: UILabel!
    let back = UIView.init()

    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        back.backgroundColor = UIColor.white
        back.clipsToBounds = true
        addSubview(back)
        back.snp.makeConstraints { (make) in
            make.edges.equalTo(UIEdgeInsets.init(top: 10, left: 15, bottom: 10, right: 15))
        }
        back.layoutIfNeeded()
        back.setNeedsLayout()
        
        back.layer.cornerRadius = 4
        back.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.15).cgColor
        back.layer.shadowOffset = CGSize(width: 0, height: 1.5)
        back.layer.shadowOpacity = 1
        back.layer.shadowRadius = 4
        back.clipsToBounds = false

        tx = UIImageView.init(image: #imageLiteral(resourceName: "zhuanhuan@1.5x"))
        tx.layer.cornerRadius = 35/2
        tx.clipsToBounds = true
        back.addSubview(tx)
        tx.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview().multipliedBy(0.6)
            make.left.equalToSuperview().offset(15)
            make.width.height.equalTo(35)
        }
        
        mz = UILabel.init()
        mz.lgf_AddShowAllText()
        mz.font = UIFont.boldSystemFont(ofSize: 14)
        mz.textColor = UIColor.init(lgf_HexString: "222222")
        mz.text = "来国锋"
        back.addSubview(mz)
        mz.snp.makeConstraints { (make) in
            make.top.equalTo(tx)
            make.left.equalTo(tx.snp.right).offset(10)
        }
        
        sg = UILabel.init()
        sg.lgf_AddShowAllText()
        sg.font = UIFont.boldSystemFont(ofSize: 12)
        sg.textColor = UIColor.init(lgf_HexString: "8D969D")
        sg.text = "175cm"
        back.addSubview(sg)
        
//        let line1 = UIView.init()
//        line1.backgroundColor = UIColor.init(lgf_HexString: "8D969D")
//        back.addSubview(line1)
//        line1.snp.makeConstraints { (make) in
//            make.centerY.equalTo(tx)
//            make.right.equalTo(sg.snp.left).offset(-10)
//            make.width.equalTo(1)
//            make.height.equalTo(7)
//        }
//
//        tz = UILabel.init()
//        tz.font = UIFont.systemFont(ofSize: 12)
//        tz.textColor = UIColor.init(lgf_HexString: "8D969D")
//        tz.text = "59kg"
//        back.addSubview(tz)
//        tz.snp.makeConstraints { (make) in
//            make.centerY.equalTo(tx)
//            make.right.equalTo(line1.snp.left).offset(-10)
//        }

        let line2 = UIView.init()
        line2.backgroundColor = UIColor.init(lgf_HexString: "8D969D")
        back.addSubview(line2)

        nl = UILabel.init()
        nl.lgf_AddShowAllText()
        nl.font = UIFont.systemFont(ofSize: 12)
        nl.textColor = UIColor.init(lgf_HexString: "8D969D")
        nl.text = "23岁"
        back.addSubview(nl)
        nl.snp.makeConstraints { (make) in
            make.left.equalTo(mz)
            make.right.equalTo(line2.snp.left).offset(-10)
            make.bottom.equalTo(tx)

        }
        
        line2.snp.makeConstraints { (make) in
            make.centerY.equalTo(nl)
//            make.right.equalTo(sg.snp.left).offset(-10)
            make.width.equalTo(1)
            make.height.equalTo(7)
            make.left.equalTo(nl.snp.right).offset(10)
        }

        sg.snp.makeConstraints { (make) in
            make.centerY.equalTo(line2)
            make.left.equalTo(line2.snp.right).offset(10)
        }

        
        sj = UILabel.init()
        sj.lgf_AddShowAllText()
        sj.font = UIFont.boldSystemFont(ofSize: 16)
        sj.textColor = UIColor.init(lgf_HexString: "222222")
        sj.text = "18358173178"
        back.addSubview(sj)
        sj.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview().multipliedBy(1.45)
            make.left.equalToSuperview().offset(15)
        }
        
        status = UIView.init()
        status.layer.cornerRadius = 2
        status.clipsToBounds = true
        status.backgroundColor = UIColor.init(lgf_HexString: "6E99BF")
        back.addSubview(status)
        status.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(14)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(20)
        }
        
        xsj = UILabel.init()
        xsj.text = "新数据"
        xsj.font = UIFont.systemFont(ofSize: 13)
        xsj.textColor = UIColor.white
        xsj.textAlignment = .center
        xsj.backgroundColor = UIColor.init(lgf_HexString: "0F88F2")
        status.addSubview(xsj)
        xsj.snp.makeConstraints { (make) in
            make.top.left.bottom.equalToSuperview()
            make.width.equalTo(50)
        }
        
        status_l = UILabel.init()
        status_l.font = UIFont.systemFont(ofSize: 13)
        status_l.textColor = UIColor.white
        status_l.textAlignment = .center
        status.addSubview(status_l)
        status_l.snp.makeConstraints { (make) in
            make.left.equalTo(xsj.snp.right).offset(5)
            make.right.equalToSuperview().offset(-5)
            make.top.bottom.equalToSuperview()
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()

    }
}
